/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package moviefansystem.Gui;

import com.sun.org.apache.bcel.internal.generic.ConversionInstruction;
import moviefansystemControllers.Controller;
import moviefansystemControllers.GuiController;

/**
 *
 * @author Nick
 */
public class Gui_Ingelogt extends javax.swing.JFrame {
    
    Controller con;
    GuiController gCon;
    /**
     * Creates new form Gui_Ingelogt
     */
    public Gui_Ingelogt(GuiController gCon) {
        initComponents();
        
        con = new Controller();
        this.gCon = gCon;
        
    }

    private Gui_Ingelogt() {
        throw new UnsupportedOperationException("Not yet implemented");
    }
    public void close()
    {
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        tfKlantnummer = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        LabelNieuweKlant = new javax.swing.JLabel();
        LabelNieuweFilm = new javax.swing.JLabel();
        BtZoekKlant = new javax.swing.JButton();
        LabelError = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel1.setText("Klantnummer:");

        LabelNieuweKlant.setText("Nieuwe klant aanmaken.");
        LabelNieuweKlant.setToolTipText("Klik hier om een klant toevoegen");
        LabelNieuweKlant.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        LabelNieuweKlant.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                LabelNieuweKlantMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                LabelNieuweKlantMouseEntered(evt);
            }
        });

        LabelNieuweFilm.setText("Nieuwe film toevoegen.");
        LabelNieuweFilm.setToolTipText("Klik hier om een film  toevoegen");
        LabelNieuweFilm.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        LabelNieuweFilm.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                LabelNieuweFilmMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                LabelNieuweFilmMouseEntered(evt);
            }
        });
        LabelNieuweFilm.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                LabelNieuweFilmKeyPressed(evt);
            }
        });

        BtZoekKlant.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        BtZoekKlant.setText("Zoek Klant");
        BtZoekKlant.setToolTipText("Klik hier om de klan te zoeken");
        BtZoekKlant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtZoekKlantActionPerformed(evt);
            }
        });

        LabelError.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        LabelError.setForeground(new java.awt.Color(255, 0, 0));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(BtZoekKlant, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(166, 166, 166)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(LabelError, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(LabelNieuweFilm, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
                        .addComponent(LabelNieuweKlant, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(tfKlantnummer, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)))
                .addContainerGap(408, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(137, 137, 137)
                .addComponent(LabelError, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(56, 56, 56)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tfKlantnummer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addComponent(LabelNieuweKlant)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(LabelNieuweFilm)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 138, Short.MAX_VALUE)
                .addComponent(BtZoekKlant, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void LabelNieuweFilmKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_LabelNieuweFilmKeyPressed
        
        
        
        
    }//GEN-LAST:event_LabelNieuweFilmKeyPressed

    private void BtZoekKlantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtZoekKlantActionPerformed
    String bufferKlantNr = tfKlantnummer.getText();// het klant nummer uit de GUi
    
    if(bufferKlantNr.contentEquals("") )//indien klantnr leeg is
    {
        LabelError.setText("Klant nummer mag niet leeg zijn");
    }
    else
    {
    int KlantNr = Integer.parseInt(bufferKlantNr);//String --> Int

    gCon.KlantGevonden(true, con.getKlant(KlantNr));
    gCon.ingelogt(false);
    //Gui_KlantGevonden frame = new Gui_KlantGevonden(con.getKlant(KlantNr));//open de nieuwe GUI
    //frame.setVisible(true);
    }
    }//GEN-LAST:event_BtZoekKlantActionPerformed

    private void LabelNieuweKlantMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LabelNieuweKlantMouseClicked
     gCon.nieuweKlant(true);
     gCon.ingelogt(false);
    //Gui_NieuweKlant frame = new Gui_NieuweKlant();//Gui tbv nieuwe klant toevoegen
    //frame.setVisible(true);
  
    }//GEN-LAST:event_LabelNieuweKlantMouseClicked

    private void LabelNieuweKlantMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LabelNieuweKlantMouseEntered
    LabelNieuweKlant.createToolTip();
  
    }//GEN-LAST:event_LabelNieuweKlantMouseEntered

    private void LabelNieuweFilmMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LabelNieuweFilmMouseEntered

    }//GEN-LAST:event_LabelNieuweFilmMouseEntered

    private void LabelNieuweFilmMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LabelNieuweFilmMouseClicked
    gCon.nieuweFilm(true);
    gCon.ingelogt(false);
    //Gui_NieuweFilm frame = new Gui_NieuweFilm();//nieuwe gui tbv nieuwe film toevoegen
    //frame.setVisible(true);
    }//GEN-LAST:event_LabelNieuweFilmMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Gui_Ingelogt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Gui_Ingelogt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Gui_Ingelogt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Gui_Ingelogt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Gui_Ingelogt().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BtZoekKlant;
    private javax.swing.JLabel LabelError;
    private javax.swing.JLabel LabelNieuweFilm;
    private javax.swing.JLabel LabelNieuweKlant;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField tfKlantnummer;
    // End of variables declaration//GEN-END:variables
}
